package cn.com.shaom.learning.sb.data.mongodb.dao;

import cn.com.shaom.learning.sb.data.mongodb.User;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * ClassName: UserRe
 * Description:
 * Date: 2017/12/27 10:29 【需求编号】
 *
 * @author Shaom
 * @version V1.0.0
 */
public interface UserRepository extends MongoRepository<User, String> {

    /**
     * 方法名查询
     *
     * @param name
     * @return
     */
    User findByName(String name);

    /**
     * @param age
     * @return
     * @Query 查询，查询参数只要构造json即可
     */
    @Query("{'age':?0}")
    List<User> withQueryFindAge(Integer age);
}
